package work2;

public class ThrowDemo {
    public static void main(String[] args) {
        Student ls=new Student();
        try {
            ls.setAge1(20);
            System.out.println("该学生的年龄为："+ls.getAge1()+"岁");
        }catch (Exception e){
            System.out.println("年龄不合法");
        }
    }
}
